require 'net/http'
require 'rubygems'
require 'xmlsimple'

class Weather < ActiveRecord::Base
	def self.search(localcode, dayf)		
		
		url = 'http://xoap.weather.com/weather/local/' + localcode + '?cc=*&dayf=' + dayf;

		xml_data = Net::HTTP.get_response(URI.parse(url)).body
			
		data = XmlSimple.xml_in(xml_data)
		
		return data
	end
end
